﻿using System;
using System.ServiceModel;
using System.Collections.Generic;
using Sinacor.Infra.Common.Exceptions;
using Sinacor.Infra.Service.ExceptionHandling;
using Sinacor.Infra.Service.Security.Services;
using Sinacor.Infra.Common;
using Sinacor.Infra.Common.Exceptions.FaultContracts;

namespace Sinacor.Servico.Bovespa.Alocacao.Service.ServiceContract
{

    /// <summary>
    /// Contrato de serviço que expõe os métodos para tratamento de recompra
    /// </summary>
    [ExceptionShielding]
    [ServiceContract(Namespace = "http://www.bovespa.com.br/Sinacor.Servico.Bovespa.Alocacao.Service.ServiceContract", SessionMode = SessionMode.Allowed, Name = "IRecompra")]
    public interface IRecompra
    {

        #region Métodos
        /// <summary>
        /// Atualiza a composição financeira de uma recompra
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [TransactionRequired]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "AtualizarComposicaoFinanceiraRecompra")]
        void AtualizarComposicaoFinanceiraRecompra(DataContract.Request.ComposicaoFinanceiraRecompraRequest request);

        /// <summary>
        /// Consulta as execuções de uma determinada recompra
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "ConsultarExecucoesRecompra")]
        List<DataContract.Response.ExecucaoRecompraResponse> ConsultarExecucoesRecompra(DataContract.Request.FiltroRecompraChaveRequest request);

        /// <summary>
        /// Consulta falhas que originaram recompras
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "ConsultarFalhasRecompras")]
        List<DataContract.Response.FalhaRecompraResponse> ConsultarFalhasRecompras(DataContract.Request.FiltroFalhaRecompraRequest request);

        /// <summary>
        /// Consulta uma lista de recompras conforme o filtro de pesquisa
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "ConsultarRecompras")]
        List<DataContract.Response.RecompraResponse> ConsultarRecompras(DataContract.Request.FiltroRecompraRequest request);

        
        /// <summary>
        /// Obtém a composição financeira de uma determinada recompra
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "ObterComposicaoFinanceiraRecompra")]
        DataContract.Response.ComposicaoFinanceiraRecompraResponse ObterComposicaoFinanceiraRecompra(DataContract.Request.FiltroRecompraChaveRequest request);

        /// <summary>
        /// Obtém uma recompra, com suas execuções, composição financeira e valores de
        /// despesa
        /// </summary>
        /// <param name="request"></param>
        [OperationLog]
        [FaultContract(typeof(BusinessFault))]
        [FaultContract(typeof(ValidationFault))]
        [FaultContract(typeof(GeneralFault))]
        [FaultContract(typeof(InvalidSessionFault))]
        [FaultContract(typeof(LicensingFault))]
        [FaultContract(typeof(AccessIsDeniedFault))]
        [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "ObterRecompra")]
        DataContract.Response.RecompraResponse ObterRecompra(DataContract.Request.FiltroRecompraChaveRequest request);
        #endregion Métodos


    }

}